<!--<form class="layui-form" action="">-->
    <div class="layui-form-item" style="border: 1px solid #C0C4CC;margin: 8px 6px 4px 6px;padding-top: 2px">
        <label class="layui-form-label">条件脚本：</label>
        <div class="layui-input-block">
            <input type="text" id="choice" required  lay-verify="required" disabled="disabled" autocomplete="off" class="layui-input" style="float: left;width: 300px">
            <a class="layui-btn layui-btn-xs" id="choiceScript" style="margin-top:6px;margin-left:4px">选择</a>

        </div>
    </div>
<!--</form>-->
<table class="layui-table" id="scriptParameters" style="margin-left: 6px;width: 98%">
    <thead>
    <tr >
        <th style="text-align: center;">参数名称</th>
        <th style="text-align: center;">参数类型</th>
        <th style="text-align: center;">参数说明</th>
        <th style="text-align: center;">参数值</th>
    </tr>
    </thead>
    <tbody class="contentDivs">

    </tbody>
</table>

<div class="layui-btn-container" style="text-align: center;position: absolute;bottom: 15px;left: 0px;right: 0px;">
    <button class="layui-btn" lay-submit lay-filter="varForm">确定</button>
    <button class="layui-btn layui-btn-danger" id="close">关闭</button>
</div>
<div id="windowUrls2" style="display: none"></div>
<script>

    //Demo
    layui.use(['layer', 'form', 'element','table','setter'], function(){
        var setter=layui.setter;
        var modelId = "${modelId}";
        var layer = layui.layer
            , form = layui.form
            , element = layui.element
            , table = layui.table;

        $('#windowUrls2').load("${ctx}/workflow/bpmNodeUser/view/chooseScript?modelId="+modelId)

        $('#choiceScript').click(function () {
            layer.open({
                title:'脚本1',
                type: 1,
                shade: 0.3,
                area: ['100%', '100%'],
                content: $('#windowUrls2').html(),
                zIndex: layer.zIndex,
            });

            form.render();

            table.render({
                elem: '.layui-layer #scriptModel'
                , url: serverPath.workflowPath + setter.workflowLinkPath + 'conditionScript/selector${modelId!}'
                , method: 'post'
                , toolbar: '#headerToolsBar'
                , height: 300
                , page: false
                , parseData: function (re) {

                }
                , cols: [[
                    {type: 'radio', fixed: 'left',width: 40},
                    {field: 'id', title: 'ID', sort: true, hide: true},
                    {field: 'methodName', title: '方法名', align: 'center' ,width:110}
                    , {field: 'methodDesc', title: '方法描述', align: 'center',width:110}
                    , {field: 'className', title: '脚本所在类的类名', align: 'center',width:280,padding:0}
                    , {field: 'classInsName', title: '类实例名', align: 'center'}
                    , {field: 'returnType', title: '是否生效', align: 'center'}
                ]]
            });

            function scriptChoice() {

            }
            var checkStatus;
            table.on('toolbar(scriptModel)', function(obj){
                checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
                switch(obj.event){
                    case 'getCheckData':
                        var data = checkStatus.data;  //获取选中行数据

                        $('#choice').val(data[0].methodDesc);//null


                        //获取JSON数据，并转换格式
                        var jsonStr =eval(data);
                        //存储JSON数据
                        var json ;
                        //获取特定的JSON数据
                        for (var i=0;i<jsonStr.length;i++){
                            for(var key in jsonStr[i]){
                                if(key == 'argument')
                                    json = eval(jsonStr[i][key]);

                            }
                        }
                        //<tbody>包含内容
                        var trStr ;
                        //循环获取数据
                        for (var i=0;i<json.length;i++){
                            var tdStr = "<tr>";
                            for(var key in json[i]) {
                                switch (key) {
                                    //参数名称
                                    case 'paraName':
                                        tdStr += "<td>"+json[i][key]+"</td>";
                                        break;
                                    //参数类型
                                    case 'paraType':
                                        tdStr += "<td>"+json[i][key]+"</td>";
                                        break;
                                    //参数说明
                                    case 'paraDesc':
                                        tdStr += "<td>"+json[i][key]+"</td>";
                                        break;
                                    //参数值
                                    case 'paraCt':
                                        tdStr += "<td><select name=\"paraValType\" onchange=\"paraValTypeChange(this)\"> <option value=\"1\">流程变量</option> <option value=\"2\">固定值</option> </select></td>";
                                        break;
                                }
                            }
                            tdStr += "</tr>";
                            trStr += tdStr;
                        }
                        //将内容添加显示在表格上
                        $(".contentDivs").html(trStr);

                        //重新渲染table

                        table.reload();

                        layer.close(layer.index);
                        break;
                };
            });

        })

        $(document).on('click', '#close', function () {
            parent.layer.close(index);
        })

        //子弹窗关闭
        var index = parent.layer.getFrameIndex(window.name);
        $(document).on('click', '#close1', function () {
                layer.close(layer.index);
        });

    });
</script>